﻿using System.Collections.Generic;
using System.Configuration;
using LogManager.Base;

namespace LogManager.Config
{
    /// <summary>
    /// A configuration element that displays is a server. Contains also the session information,
    /// so the server can query the machine.
    /// </summary>   
    public class ServerConfiguration : ConfigurationElement,IServer
    {
        private IDictionary<string, object> _properties = new Dictionary<string, object>();

        #region IServer Members        

        /// <summary>
        /// Identic name of the server
        /// </summary>
        [ConfigurationProperty("serverName", IsKey = true)]
        public string ServerName
        {
            get { return (string) this["serverName"]; }
            set { this["serverName"] = value; }
        }

        public new IDictionary<string, object> Properties
        {
            get { return _properties; }
        }

        /// <summary>
        /// Domain name of the server e.g. mms-epm01.oc-ag.ch
        /// </summary>
        [ConfigurationProperty("serverDomain")]
        public string ServerDomain
        {
            get { return (string) this["serverDomain"]; }
            set { this["serverDomain"] = value; }
        }
        
        /// <summary>
        /// If the machine is a local machine.
        /// </summary>
        [ConfigurationProperty("isLocal")]
        public bool IsLocal
        {
            get { return (bool) this["isLocal"]; }
            set { this["isLocal"] = value;}
        }

        #endregion
    }
}